{	Problem: http://codeforces.ru/problemset/problem/74/A
	Verdict: Accepted
}
uses SysUtils;
var i,n,k:longint; t:array[0..60] of string; a:Array[0..60] of longint; s:string;
procedure qsort(l,r:longint);
var i,j,x,y:longint; s:string;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
  while a[i]>x do inc(i);
  while a[j]<x do dec(j);
  if i<=j then begin
    y:=a[i];
    a[i]:=a[j];
    a[j]:=y;
    s:=t[i];
    t[i]:=t[j];
    t[j]:=s;
    inc(i);
    dec(j);
  end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
readln(n);
fillchar(A,sizeof(a),0);
for i:=1 to n do begin
  readln(s);
  t[i]:=copy(s,1,pos(' ',s)-1);
  delete(s,1,pos(' ',s));
  k:=strtoint(copy(s,1,pos(' ',s)-1));
  inc(a[i],k*100);
  delete(s,1,pos(' ',s));
  k:=strtoint(copy(s,1,pos(' ',s)-1));
  dec(a[i],k*50);
  delete(s,1,pos(' ',s));
  k:=strtoint(copy(s,1,pos(' ',s)-1));
  inc(a[i],k);
  delete(s,1,pos(' ',s)); 
  k:=strtoint(copy(s,1,pos(' ',s)-1));
  inc(a[i],k);
  delete(s,1,pos(' ',s));
  k:=strtoint(copy(s,1,pos(' ',s)-1));
  inc(a[i],k);
  delete(s,1,pos(' ',s));
  k:=strtoint(copy(s,1,pos(' ',s)-1));
  inc(a[i],k);
  delete(s,1,pos(' ',s));
  k:=strtoint(s);
  inc(a[i],k);
end;
qsort(1,n);
write(t[1]);
end.